/* 
 * Copyright 2011 kOSMik.
 * This file is part of kOSMik.
 * 
 * kOSMik is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * kOSMik is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with kOSMik.  If not, see <http://www.gnu.org/licenses/>.
 *  
 * kOSMik:
 * Open Street Map - Editor.
 * http://code.google.com/p/swp-dv-ws2010-osm-2/
 */

package de.fuberlin.kosmik.data;

/**
 * Enumeration class for database queries.
 * 
 */
public enum DataBaseQuery {
	/**
	 * Table that stores references to media (pictures, video, audio).
	 */
	MEDIA("" + "CREATE TABLE media (" + "  point_id int(11) NOT NULL,"
			+ "  content TEXT NOT NULL," + "  format VARCHAR NOT NULL,"
			+ "  PRIMARY KEY (point_id, content)" + ");"),

	/**
	 * Table that contains all POIs.
	 */
	POI("" + "CREATE TABLE poi (" + "  id INTEGER PRIMARY KEY NOT NULL,"
			+ "  point_id int(11) NOT NULL" + ");"),

	/**
	 * Table that contains all points, i.e. all geo fixes that have been
	 * recorded.
	 */
	POINT("" + "CREATE TABLE point (" + "  id INTEGER PRIMARY KEY NOT NULL,"
			+ "  track_id int(11) NOT NULL," + "  lng REAL NOT NULL," + "  lat REAL NOT NULL,"
			+ "  time DATE NOT NULL" + ");"),
	/**
	 * Table that associates points with ways.
	 */
	POINTS_HAVE_WAYS("" + "CREATE TABLE points_have_ways (" + "  point_id int(11) NOT NULL,"
			+ "  way_id int(11) NOT NULL," + "  PRIMARY KEY (point_id, way_id)" + ");"),
	/**
	 * Table that stores attributes of a POI.
	 */
	POI_VALUE("" + "CREATE TABLE poi_value (" + "  k TEXT NOT NULL,"
			+ "  poi_id int(11) NOT NULL," + "  v TEXT NOT NULL," + "  PRIMARY KEY (k, poi_id)"
			+ ");"),
	/**
	 * Table that stores the tracks.
	 */
	TRACK("" + "CREATE TABLE track (" + "  id INTEGER PRIMARY KEY NOT NULL," + "  name TEXT,"
			+ "  time DATE" + ");"),
	/**
	 * Table that stores ways.
	 */
	WAY("" + "CREATE TABLE way (" + "  id INTEGER PRIMARY KEY NOT NULL," + "  is_area BOOL,"
			+ "  name TEXT" + ");"),
	/**
	 * Table that stores meta information to ways.
	 */
	WAY_VALUE("" + "CREATE TABLE way_value (" + "  way_id int(11) NOT NULL,"
			+ "  k TEXT NOT NULL," + "  v TEXT," + "  PRIMARY KEY (way_id, k)" + ");");
	private String query;

	DataBaseQuery(String query) {
		this.query = query;
	}

	/**
	 * Get the entire query as string.
	 * 
	 * @return the complete query as string.
	 */
	public String getQuery() {
		return query;
	}

}